using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Curchy.PERTToolbox.Properties;


namespace Curchy.PERTToolbox.WinUI
{
    public partial class SystemSettingsEntry : Form
    {
        public SystemSettingsEntry()
        {
            InitializeComponent();
        }

        private void SystemSettings_Load(object sender, EventArgs e)
        {
            chkFileAssociation.Checked = Service.InitializationToolbox.Instance.IsAssociated;
        }

        private void SystemSettings_FormClosing(object sender, FormClosingEventArgs e)
        {
            Settings.Default.Save();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void chkFileAssociation_CheckedChanged(object sender, EventArgs e)
        {
            if (chkFileAssociation.Checked)
            {
                Service.InitializationToolbox.Instance.InitializeFileAssociation();
            }
            else
            {
                Service.InitializationToolbox.Instance.RemoveFileAssociation(); 
            }
        }
    }
}